#coding=utf-8
'''突破前期平台'''
from stockdb.misc import *
import strategy.basic as basic
from strategy.turtle.filter import breakout_filter

dt = '2008-07-29'
print dt
tds = find_tds_on(dt)

'''
tf = basic.TDFilter(tds)
tds = tf.filter_by(breakout_filter, 10, 1).\
            filter_by(basic.tdattr_filter, 'close', 5, 30).\
            all()

print len(tds)
'''

ss = []
for td in tds:
    s = td.fins
        
    tds2 = s.tds_between('2008-04-25', '2008-06-06')
    ps = [t.price.fq('close') for t in tds2]
    if not ps:continue
    highest = max(ps)
    
    fc = s.find_td(dt).price.fq('close')
    r = (fc - highest)*100/highest
    if r > 5:
        print s, s.name, int(r)
        ss.append(s)
print len(ss)   
